package com.kedou.sdk.params;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;
import com.kedou.sdk.params.bean.Goods;

/**
 * Created by Administrator on 2017/6/9 0009.
 */

public class CreateOrderRequestParams extends BaseRequestParams implements Parcelable {

    private static final String SERVICE = "addOrder";
    private String pay_id;
    private String voucher_collection_id;
    /**
     * 区服名称
     */
    @SerializedName("server_name")
    private String serverName;

    private String role_name;

    private String server_num;
    /**
     * 角色ID
     */
    @SerializedName("role_id")
    private String roleId;
    private long money;
    private String goods_name;
    private String goods_desc;

    private String cp_data;
    private String placement_platform_appid = "0";


    private String device = "Android";
//    private String product_id;


    public String getPlacement_platform_appid() {
        return placement_platform_appid;
    }

    public void setPlacement_platform_appid(String placement_platform_appid) {
        this.placement_platform_appid = placement_platform_appid;
    }

    public CreateOrderRequestParams(Goods goods) {
        this( "0", "0", goods);
    }

    public String getPay_id() {
        return pay_id;
    }

    public void setPay_id(String pay_id) {
        this.pay_id = pay_id;
    }

    public String getVoucher_collection_id() {
        return voucher_collection_id;
    }

    public void setVoucher_collection_id(String voucher_collection_id) {
        this.voucher_collection_id = voucher_collection_id;
    }

    public String getServerName() {
        return serverName;
    }

    public void setServerName(String serverName) {
        this.serverName = serverName;
    }

    public String getRole_name() {
        return role_name;
    }

    public void setRole_name(String role_name) {
        this.role_name = role_name;
    }

    public String getServer_num() {
        return server_num;
    }

    public void setServer_num(String server_num) {
        this.server_num = server_num;
    }

    public String getRoleId() {
        return roleId;
    }

    public void setRoleId(String roleId) {
        this.roleId = roleId;
    }

    public long getMoney() {
        return money;
    }

    public void setMoney(long money) {
        this.money = money;
    }

    public String getGoods_name() {
        return goods_name;
    }

    public void setGoods_name(String goods_name) {
        this.goods_name = goods_name;
    }

    public String getGoods_desc() {
        return goods_desc;
    }

    public void setGoods_desc(String goods_desc) {
        this.goods_desc = goods_desc;
    }

    public String getCp_data() {
        return cp_data;
    }

    public void setCp_data(String cp_data) {
        this.cp_data = cp_data;
    }

    public String getDevice() {
        return device;
    }

    public void setDevice(String device) {
        this.device = device;
    }

    public CreateOrderRequestParams(String payType, String voucher, Goods goods) {
        this.pay_id = payType;
        this.voucher_collection_id = voucher;
        this.serverName = goods.getServerName();
        this.role_name = goods.getRoleName();
        this.server_num = String.valueOf(goods.getServerId());
        this.roleId = goods.getRoleId();
        this.money = goods.getGoodsPrice();
        this.goods_name = goods.getGoodsName();
        this.goods_desc = goods.getGoodsDesc();
        this.cp_data = goods.getExtraData();


    }




    @Override
    public String getServiceString() {
        return SERVICE;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeLong(this.money);
        dest.writeString(this.pay_id);
        dest.writeString(this.voucher_collection_id);
        dest.writeString(this.serverName);
        dest.writeString(this.role_name);
        dest.writeString(this.server_num);
        dest.writeString(this.roleId);
        dest.writeString(this.goods_name);
        dest.writeString(this.goods_desc);
        dest.writeString(this.cp_data);
        dest.writeString(this.device);
        dest.writeString(this.placement_platform_appid);
    }

    protected CreateOrderRequestParams(Parcel in) {
        super(in);
        this.money = in.readLong();
        this.pay_id = in.readString();
        this.voucher_collection_id = in.readString();
        this.serverName = in.readString();
        this.role_name = in.readString();
        this.server_num = in.readString();
        this.roleId = in.readString();
        this.goods_name = in.readString();
        this.goods_desc = in.readString();
        this.cp_data = in.readString();
        this.device = in.readString();
        this.placement_platform_appid = in.readString();
    }

    public static final Creator<CreateOrderRequestParams> CREATOR = new Creator<CreateOrderRequestParams>() {
        @Override
        public CreateOrderRequestParams createFromParcel(Parcel source) {
            return new CreateOrderRequestParams(source);
        }

        @Override
        public CreateOrderRequestParams[] newArray(int size) {
            return new CreateOrderRequestParams[size];
        }
    };
}
